layui.config({
    base: "/js/modules/"
}).extend({
    "listView": "listView"
});
layui.use(['form', 'listView', 'laydate', 'jquery', 'common'], function () {
    let layDate = layui.laydate,
        form = layui.form,
        common = layui.common,
        layer = layui.layer,
        $ = layui.$;

    layDate.render(
        {
            elem: "#beginTime", trigger: 'click', type: 'datetime'
        }
    );
    layDate.render(
        {
            elem: "#endTime", trigger: 'click', type: 'datetime'
        }
    );

    layui.listView.tableInit({
        id: 'deviceData',
        url: 'data/page',
        page: true,
        cols: [
            {field: 'number', title: '序号', fixed: 'true', type: 'numbers'},
            {field: 'typeName', title: '类型'},
            {field: 'deviceName', title: '设备名称'},
            {field: 'no', title: '设备编号'},
            {field: 'paramsName', title: '参数名称'},
            {
                field: 'paramsValue', title: '参数值', templet: function (d) {
                    return d.paramsValue + d.unit;
                }
            },

            {field: 'createTime', title: '上传时间'},
        ]
    });

    $('#add').on('click', function () {
        layer.open({
            title: '新增设备类型',
            type: 2,
            area: ['1000px', '340px'],
            fixed: false, //不固定
            maxmin: true,
            content: 'toAddDeviceType'
        });
    });

});
